/*
 *
 * @ProjectName:    my_umi_app
 * @Package:
 * @ClassName:      blog_ad_api
 * @Description:    Ad
 * @Author:         SuPeiSen
 * @CreateDate:     2021/2/25 11:36 上午
 * @UpdateDate:     2021/2/25 11:36 上午
 * @UpdateRemark:   更新说明：
 * @Version:        1.0
 */

import { Requests } from '@/utils/requests';
import { BlogApiPath } from '@/config/api_config';
import {
  BlogAdItemType,
  BlogRecommendedArticleType,
} from '@/type/blog/ad_type';

/**
 * 获取推荐阅读
 * @constructor
 */
export const BlogGetRecommendedArticle = async () => {
  return await Requests.defaults.httpNo<Array<BlogRecommendedArticleType>>(
    'get',
    BlogApiPath.blogRecommendedArticle,
  );
};

/**
 * 获取广告
 * @constructor
 */
export const BlogGetAdListApi = async () => {
  return await Requests.defaults.http<Array<BlogAdItemType>>(
    'get',
    BlogApiPath.blogGetAdList,
  );
};

/**
 * 触发广告点击
 * @constructor
 */
export const BlogAdOnClick = async (id: number) => {
  return await Requests.defaults.http('get', BlogApiPath.blogAdOnClick, {
    getData: { id: id },
  });
};
